package filehandler;

import evthandler.EventMessage;
import java.io.*;
import java.util.ArrayList;

/**
 *
 * @author Casper, Dennis, Jackie, Jakob
 * @version 1.00
 */
public class Reader extends BufferedReader{

    /**
     *
     * @param file
     */
    public Reader(File file) throws FileNotFoundException {
        super(new FileReader(file));
    }

    /**
     *
     * @return
     */
    public ArrayList<String> readFile() {
        ArrayList<String> lines = new ArrayList<String>();
        try {
            String line;
            while ((line = readLine()) != null) {
                lines.add(line);
            }
            close();
            return lines;
        } catch (FileNotFoundException ex) {
            new EventMessage("File not found", "The file could not be found at the expected place").showException(ex);
            return null;
        } catch (IOException ex) {
            new EventMessage("File reading error", "The file could not be read").showException(ex);
            return null;
        }
    }
}
